package kz.sdu.javaee.techsupport.gui;

import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.*;
import com.vaadin.ui.Window;
import kz.sdu.javaee.techsupport.TeApplication;

/**
 * Created by IntelliJ IDEA.
 * User: true
 * Date: 4/28/12
 * Time: 1:23 AM
 * To change this template use File | Settings | File Templates.
 */
public class AdminWindow extends Window {

    private TeApplication application;
    private MenuBar menubar;

    public AdminWindow(TeApplication application){
        super();
        this.application = application;
        this.menubar = new MenuBar();
        MenuItem usersMenu = menubar.addItem("Users", null);
        MenuItem issuesMenu = menubar.addItem("Issues", null);
        usersMenu.addItem("Manage",manageUsersCommand);
        issuesMenu.addItem("View my issues", listMyIssuesCommand);
        issuesMenu.addItem("View group issues",listGroupIssuesCommand);
        issuesMenu.addItem("View all issues", manageIssuesCommand);
        MenuItem logoutMenu = menubar.addItem("Logout", logoutCommand);
        menubar.setWidth("100%");
        addComponent(menubar);



    }

    private Command manageUsersCommand = new Command() {
        public void menuSelected(MenuItem selectedItem) {
            getWindow().showNotification("Action " + selectedItem.getText());
        }
    };

    private Command manageIssuesCommand = new Command() {
        public void menuSelected(MenuItem selectedItem) {
            getWindow().showNotification("Action " + selectedItem.getText());
        }
    };

    private Command listMyIssuesCommand = new Command() {
        public void menuSelected(MenuItem selectedItem) {
            getWindow().showNotification("Action " + selectedItem.getText());
        }
    };

    private Command listGroupIssuesCommand = new Command() {
        public void menuSelected(MenuItem selectedItem) {
            getWindow().showNotification("Action " + selectedItem.getText());
        }
    };


    private Command logoutCommand = new Command() {
        public void menuSelected(MenuItem selectedItem) {
            getWindow().showNotification("Action " + selectedItem.getText());
        }
    };



}
